#include "reg52.h" 

sbit KEY1 = P3^1;
sbit LED  = P2^0;

void delay(unsigned int i)
{
	while(i--);
}

void main()
{
	unsigned int count = 0;
  while(1)
	{
	  if(KEY1 == 0)
		{
		  delay(1000);
			if(KEY1 == 0)
			{
			  count++;
				while(!KEY1);
			}
		}
		if(count == 2)
		{
		  LED = 0;
			delay(50000);
			delay(50000);
			LED = 1;
			count = 0;
		}
	}
}